/**
 * @author iello-dev
 */
window.addEvent('domready', function(){
    if ($('slideshow') != null) {
        var slideshow = new BarackSlideshow('menu', 'pictures', 'loading', {
            auto: true,
            autostart: true
        });
    }
    if ($('dropdown-menu') != null) {
        var dropdown = new UvumiDropdown("dropdown-menu", {
            duration: 500, //default was 250ms
            delay: 1000, //default was 500ms
            clickToOpen: false //default was false 
        });
    }
	if ($$('a.moo-popup').length >0){
        var popup = new multiBox({
            mbClass: '.moo-popup',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
            container: $(document.body),//where to inject multiBox
            useOverlay: true,//use a semi-transparent background. default: false;
            maxSize: {
                w: 600,
                h: 400
            },
			showControls:false
        });
		popup.open(popup.index,popup.multiBox);
	}
    if ($$('a.mb').length >0) {
        var initMultiBox = new multiBox({
            mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
            container: $(document.body),//where to inject multiBox
            descClassName: 'MultiBoxDescription',//the class name of the description divs
            useOverlay: true,//use a semi-transparent background. default: false;
            openFromLink: true,//pop-up will slide in from the position of the element clicked
            maxSize: {
                w: 600,
                h: 400
            },//max dimensions (width,height) - set to null to disable resizing
            addRollover: true,//add rollover fade to each multibox link
            addOverlayIcon: false,//adds overlay icons to images within multibox links
            addChain: true,//cycle through all images fading them out then in
			addTips: true,//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
            recalcTop: true//subtract the height of controls panel from top position
        });
    }
	
	if($('shortlinks-tabs') != null){
		var tabs = new SimpleTabs('shortlinks-tabs', {
				selector: 'h4'
		});
	}
	if($('newsletter-form') != null){
		var fx = {
			'loading': new Fx.Morph( 'nl-loading',{ duration: 500 } ),
			'success': new Fx.Morph( 'nl-success',{ duration: 1000 } ),
			'fail': new Fx.Morph( 'nl-fail',{ duration: 2000 } )
		};

		new FormCheck('newsletter-form',{
			submitByAjax:true,
			ajaxResponseDiv:'nl-response',
			onAjaxRequest: function(){
				fx.loading.start({
					'opacity': [1,0]
				});	
			},
			onAjaxSuccess : function(msg){
				fx.success.start({
					'opacity': [1,0]
				});	
			},
			onAjaxFailure : function(){
				fx.fail.start({
					'opacity': [1,0]
				});	
			}
		});
	}
	if($('hot-news') != null){
		var hor = new Ticker('hot-news',{speed:1000,delay:4000,direction:'horizontal'});
	}
	if($('rss-feeds') != null){
		var vert = new Ticker('rss-feeds', { speed: 1000, delay: 2000, direction: 'vertical'});	
	} 
	if($('search') != null) {
            var fx = new Fx.Morph('search', {
                duration: 250,
                transition: Fx.Transitions.Quad.easeOut,
                wait: false
            });
            $('search').setStyle('opacity', .1);
            $('search').addEvent('mouseenter', function(){
                fx.start({
                    'opacity': 1
                });
            });
            $('search').addEvent('mouseleave', function(){
                fx.start({
                    'opacity': .1
                });
            });
	}
});
//window.addEvent('domready', function(){
//    try {
//        document.execCommand("BackgroundImageCache", false, true)
//    } 
//    catch (a) {
//    }
//});
//window.addEvent('load', function() {
//
//});